import com.gf.framework.common.utils.list.GfArrayList;
import org.junit.Test;

import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author gaofei
 * @date 2022/7/2 11:48
 */
public class sort {
    private final static List<String> sortInfo = new GfArrayList<String>().of("功能2", "功能3", "功能1", "功能4");
    private final static Map<String, Integer> sortMap = new HashMap<>();
    static {
        for (int i = 0; i < sortInfo.size(); i++) {
            sortMap.put(sortInfo.get(i), i);
        }
    }

    @Test
    public void test() {
        List<String> list = new GfArrayList<String>().of("功能1", "功能2", "功能3", "功能4");
        list.sort(Comparator.comparingInt(o -> sortMap.getOrDefault(o, -1)));
        System.out.println(list);
    }
}
